var Utils = (function(){
	
	var ajaxFail = function(jqXHR, textStatus, errorThrown){
		alert(textStatus + ": " + errorThrown);
	};
	
	var appendText = function(textAreaSelector, textToAppend){
		
		var jqTextArea = $(textAreaSelector);
		if(jqTextArea.size()>0){
			jqTextArea.get(0).value += textToAppend;
		}
		
	};
	
	
	var clearInvalid = function(context){
		$('input', context).removeClass("validation-error");
		$('.validation-message').remove();
	};
	
	var markInvalid = function(name, message, context){
		$('input[name="' + name + '"]', context).addClass("validation-error").after('<label class="validation-message">' + message + '</label>');
	};
	
	return { 
		AjaxFail: ajaxFail, 
		AppendText: appendText, 
		ClearInvalid: clearInvalid,
		MarkInvalid: markInvalid };
})();